package com.example;

import com.example.model.Product;
import com.example.model.Student;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class App {
    public static void main(String[] args) {
        // 加载Spring容器
        ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");

        // 获取Bean
        Product product = (Product) context.getBean("product");
        Student student = (Student) context.getBean("student");

        // 输出内容
        System.out.println("从Spring容器中获取的Bean：");
        System.out.println(product);
        System.out.println(student);
    }
}